Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ddl: migrate test-infra to testify for serial_test.go #30630

Merged
merged 8 commits into from
Mar 3, 2022

Conversation

wangggong
Copy link
Contributor

@wangggong wangggong commented Dec 10, 2021

What problem does this PR solve?

Issue Number: close #29113

Problem Summary:

What is changed and how it works?

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

None

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Dec 10, 2021

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • hawkingrei
  • tisonkun

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added release-note-none Denotes a PR that doesn't merit a release note. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Dec 10, 2021
@wangggong
Copy link
Contributor Author

@tisonkun PTAL

PS: for TestRecoverTableByJobIDFail & TestRecoverTableByTableNameFail, test with add hook may cause failure. Then it is temporarily commented, and maybe I need some help to deal with it.

@@ -215,23 +215,23 @@ func TestCreateTableWithLikeAtTemporaryMode(t *testing.T) {
// Test create temporary table like.
// Test auto_random.
tk.MustExec("drop table if exists auto_random_table")
_, err = tk.Exec("create table auto_random_table (a bigint primary key auto_random(3), b varchar(255));")
tk.Exec("create table auto_random_table (a bigint primary key auto_random(3), b varchar(255));")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tk.Exec => tk.MustExec

@hawkingrei
Copy link
Member

You should migrate all the test cases in the serial_test.go to testify. Please not move this case to other files. The new framework has no concept of test suite.

You can move this var _ = Suite(&testIntegrationSuite7{&testIntegrationSuite{}}) to ddl/db_integration_test.go. But do not move other things.

@wangggong
Copy link
Contributor Author

You should migrate all the test cases in the serial_test.go to testify. Please not move this case to other files. The new framework has no concept of test suite.

You can move this var _ = Suite(&testIntegrationSuite7{&testIntegrationSuite{}}) to ddl/db_integration_test.go. But do not move other things.

Well, some test cases in serial_test.go belongs to other test suites (e.g., testIntegrationSuite7, testSerialDBSuite); while in these test suites not all test cases in serial_test.go. I'm not sure whether I need modify all cases in these test suites, or just keep them not modified, or just modify the cases in the file (and cases in other files will not be modified)...

@wangggong
Copy link
Contributor Author

@tisonkun PTAL

PS: for TestRecoverTableByJobIDFail & TestRecoverTableByTableNameFail, test with add hook may cause failure. Then it is temporarily commented, and maybe I need some help to deal with it.

NOTE: TestRecoverTableByJobIDFail & TestRecoverTableByTableNameFail has fixed. Thus all testcases are available. PTAL

@sre-bot
Copy link
Contributor

sre-bot commented Dec 19, 2021

@ti-chi-bot ti-chi-bot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Dec 31, 2021
@wangggong
Copy link
Contributor Author

@hawkingrei PTAL

@ti-chi-bot ti-chi-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 8, 2022
@wangggong wangggong requested a review from a team as a code owner January 24, 2022 02:22
@ti-chi-bot ti-chi-bot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Jan 24, 2022
@tisonkun
Copy link
Contributor

@wangggong sorry to reply late. @hawkingrei and other did some works on decoupling ddl tests. Could you rebase the migrate on the nightly master? I'll review the PR then.

@ti-chi-bot ti-chi-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 1, 2022
@wangggong
Copy link
Contributor Author

@wangggong sorry to reply late. @hawkingrei and other did some works on decoupling ddl tests. Could you rebase the migrate on the nightly master? I'll review the PR then.

@tisonkun Sorry for replying late, I've merged. PTAL

ddl/db_test.go Outdated
@@ -258,6 +257,16 @@ func testGetTableByName(c *C, ctx sessionctx.Context, db, table string) table.Ta
return tbl
}

func testGetTableByNameT(t *testing.T, ctx sessionctx.Context, db, table string) table.Table {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use tk.GetTableByName.

@tisonkun
Copy link
Contributor

tisonkun commented Mar 1, 2022

@wangggong thanks for your update. Let me try to submit follow ups...

@@ -62,6 +62,14 @@ func NewTestKit(t testing.TB, store kv.Storage) *TestKit {
}
}

// NewTestKitWithInit returns a new *TestKit and creates a session.
func NewTestKitWithInit(t testing.TB, store kv.Storage) *TestKit {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We just simply write:

tk := NewTestKit(t, store)
tk.MustExec("use test")

This method is too easy to misuse unnecessarily.

@tisonkun tisonkun closed this Mar 1, 2022
@tisonkun tisonkun reopened this Mar 1, 2022
@tisonkun tisonkun removed the request for review from a team March 1, 2022 10:44
@tisonkun
Copy link
Contributor

tisonkun commented Mar 1, 2022

@wangggong @hawkingrei maybe you can cooperate on migrating this test & db_partition test, I found they're tightly coupled.

@hawkingrei
Copy link
Member

/run-unit-test

Signed-off-by: tison <wander4096@gmail.com>
Signed-off-by: tison <wander4096@gmail.com>
Signed-off-by: tison <wander4096@gmail.com>
Signed-off-by: tison <wander4096@gmail.com>
Signed-off-by: tison <wander4096@gmail.com>
@tisonkun tisonkun changed the title testify: migrate test-infra to testify for ddl/serial_test.go ddl: migrate test-infra to testify for serial_test.go Mar 3, 2022
@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Mar 3, 2022
@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Mar 3, 2022
@tisonkun
Copy link
Contributor

tisonkun commented Mar 3, 2022

/merge

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: 53bb6a3

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Mar 3, 2022
@hawkingrei
Copy link
Member

/run-unit-test

@tisonkun
Copy link
Contributor

tisonkun commented Mar 3, 2022

/run-unit-test

1 similar comment
@tisonkun
Copy link
Contributor

tisonkun commented Mar 3, 2022

/run-unit-test

@tisonkun
Copy link
Contributor

tisonkun commented Mar 3, 2022

/run-unit-test

@ti-chi-bot ti-chi-bot merged commit fb1066e into pingcap:master Mar 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note-none Denotes a PR that doesn't merit a release note. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

migrate test-infra to testify for ddl/serial_test.go
5 participants